\section{diary --- Log File}
\label{fn:diary}
\index{diary()}
\index{log file}
\index{file!logging to}
\begin{rail}
Diary : 'diary' '(' Filename')' ;
\end{rail}

The \verb+diary+ function writes a log of whatever happens in the current
\RLaB\ session after the \verb+diary+ function is called.  Both user
input and program responses are written to the file specified by the
string argument, or to the default diary file \verb+./DIARY+, if
no argument is supplied.
When the file is opened, a string containing the name of the diary
file and the date and time are written out to the diary file. Invoking
\verb+diary+ a second time with no arguments will close the currently
opened diary file. At most one diary file may be in use at any one time.


\paragraph{Example}
\index{example of diary()}
\index{diary()!example}
\begin{verbatim}
> diary()
        1
> a = 2
 a =
        2
> b = 3+rand()*1j
 b =
        3 + 1i
> diary()
        1
> system("more DIARY");
RLaB diary file: DIARY. Opened Wed Apr 27 09:36:15 1994

        1
> a = 2
 a =
        2
> b = 3+rand()*1j
 b =
        3 + 1i
> diary()
> diary("DiaryFile23");
> a = rand(2,3)+rand(2,3)*1j
 a =
 matrix columns 1 thru 3
         0.975 + 0.0847i          0.333 + 0.167i          0.162 + 0.129i
          0.647 + 0.204i         0.0369 + 0.655i           0.665 + 0.91i

> diary();
> system("more DiaryFile23");
RLaB diary file: DiaryFile23. Opened Wed Apr 27 09:42:54 1994

> a = rand(2,3)+rand(2,3)*1j
 a =
 matrix columns 1 thru 3
         0.975 + 0.0847i          0.333 + 0.167i          0.162 + 0.129i
          0.647 + 0.204i         0.0369 + 0.655i           0.665 + 0.91i

> diary();
\end{verbatim}

\newpage





